package com.eureka.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * BeanConfig
 *
 * @author 春江花朝秋月夜
 * @since 2023/12/6 1:32
 */
@Configuration
@LoadBalancerClient(value = "cloud_service",      //指定为 cloud_service 服务，只要是调用此服务都会使用我们指定的策略
        configuration = LoadBalanceConfig.class)   //指定我们刚刚定义好的配置类
public class BeanConfig {
    @Bean
    @LoadBalanced
    RestTemplate template(){
        return new RestTemplate();
    }
}
